package com.cdn.client;

import com.cdn.client.netty.client.NettyClient;
import com.cdn.client.netty.utils.RpcProperties;
import com.cdn.common.security.annotation.EnableCustomConfig;
import com.cdn.common.security.annotation.EnableRyFeignClients;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

@EnableCustomConfig
@EnableRyFeignClients
@SpringBootApplication
@EnableConfigurationProperties(RpcProperties.class)
public class CdnNodesClientApplication {
    @Resource
    private NettyClient nettyClient;

    public static void main(String[] args) {
        SpringApplication.run(CdnNodesClientApplication.class, args);
        System.out.println("边缘节点客户端模块启动成功");
    }

    @PostConstruct
    public void startNettyClient() {
        try {
            // 启动 Netty 客户端
            nettyClient.start();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}